package com.itheima.controller;
//部门管理层  解释前段传过来的数据


import com.itheima.mapper.DeptMapper;
import com.itheima.pojo.Dept;
import com.itheima.pojo.Result;
import com.itheima.service.DeptService;
import org.apache.ibatis.annotations.Insert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.xml.crypto.Data;
import java.util.List;

@RestController
//解释前段穿过来的数据 并且返回
public class DeptController {
    @Autowired
    private DeptService deptService;

    @GetMapping("/depts")
    public Result sb() {
        List<Dept> list = deptService.sb();
        return Result.success(list);

    }

    @GetMapping("/depts/{id}")
    public Result nt(@PathVariable Integer id) {
        List<Dept> list2 = deptService.nt(id);
        return Result.success(list2);
    }

    @DeleteMapping("/depst/{id}")
    public Result rb(@PathVariable Integer id) {
        List<Dept> list3 = deptService.rb(id);
        return Result.success(list3);
    }
  @PostMapping("/depst")
    public Result bib(){
        List<Dept> list4=deptService.bib();
        return Result.success(list4);
  }
  @PutMapping("/depts")
    public Result modify(){
        List<Dept> list5=deptService.modify();
        return Result.success(list5);
  }

}
